package cn.edu.xmu.orderpayment.order.microservice.retvo;

import cn.edu.xmu.orderpayment.order.model.enums.ActState;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

/**
 * @author Yujie Lin
 * @date 2021/12/9 20:08
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CouponActRetVo {

    private Long id;
    private String name;
    private Long shopId;
    private String shopName;
    @JsonFormat(shape = JsonFormat.Shape.STRING,pattern ="yyyy-MM-dd'T'HH:mm:ss.SSS")
    private LocalDateTime couponTime;
    @JsonFormat(shape = JsonFormat.Shape.STRING,pattern ="yyyy-MM-dd'T'HH:mm:ss.SSS")
    private LocalDateTime beginTime;
    @JsonFormat(shape = JsonFormat.Shape.STRING,pattern ="yyyy-MM-dd'T'HH:mm:ss.SSS")
    private LocalDateTime endTime;
    private Integer quantity;
    private Byte quantityType;
    private Byte validTerm;
    private String imageUrl;
    private String strategy;
    private Byte state;
    private Integer numKey;


    public ActState getState() {
        return ActState.getActStateByCode(Integer.valueOf(state));
    }

    public void setState(ActState state) {
        this.state=state.getCode().byteValue();
    }


}
